<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>父组件传值给子组件</title>
</head>
<body>
<!-- 父组件 -->
<div id="app">
    <input v-model="msg"/>
    <child :msg="msg"></child>
</div>
<!-- 子组件 -->
<template id="sontem">
    <h2>{{msg}}</h2>
</template>
</body>
</html>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            msg: "hello"
        },
        components: {
            "child": {
                template: "#sontem",
                props: ["msg"]
            }

    }
    })
</script>